#pragma once
//数据表类,管理数据表的结构，数据等

#include "msql_global.h"
#include "MSqlDefines.h"
#include "MSqlConnectionPool.h"

#include <QList>

namespace NsMSql
{
	class MSqlDatabase;
	class MSqlConnectionPool;
}

namespace NsMSql
{
	class MSqlTable
	{
	public:
		MSqlTable(MSqlDatabase* sqlDatabase, const QString& tableName, const QList<MTableField>& tableFields);
	private:
		//创建表
		bool create();
		//删除表
		bool drop();
	public:
		//插入一行或多行数据
		bool insertRows(const QList<QVariantList>& rows);
		//查询一行或多行数据
		QList<QVariantList> selectRows();
	private:
		MSqlDatabase* m_pSqlDatabase;
		MSqlConnectionPool* m_pSqlConnectionPool;
		QString m_tableName;
		QList<MTableField> m_tableFields;

		friend class MSqlDatabase;
	};
}

